import { HashRouter, Route, Routes } from 'react-router-dom'
import { lazy, Suspense } from 'react'
// BrowserRouter 地址无#，HashRouter为哈希路由地址带#

const Home = lazy(() => import('../pages/home')); //页面
const Login = lazy(() => import('../pages/login')); //页面
const Overview = lazy(() => import('../views/overview/index'));
const Statistics = lazy(() => import('../views/statistics/index'));
const Wall = lazy(() => import('../views/wall/index'));
const Comment = lazy(() => import('../views/comment/index'));
const Info = lazy(() => import('../views/info/index'));
const Feedback = lazy(() => import('../views/feedback/index'));
const Admercial = lazy(() => import('../views/admercial/index'));

const Router = () => {
    return (
        <HashRouter>
            <Suspense>
                <Routes>
                    <Route path='/' element={<Login></Login>}></Route>
                    <Route path='/home' element={<Home></Home>}>
                        <Route path='/home' element={<Overview></Overview>}></Route>
                        <Route path='/home/statistics' element={<Statistics></Statistics>}></Route>
                        <Route path='/home/wall' element={<Wall></Wall>}></Route>
                        <Route path='/home/comment' element={<Comment></Comment>}></Route>
                        <Route path='/home/info' element={<Info></Info>}></Route>
                        <Route path='/home/feedback' element={<Feedback></Feedback>}></Route>
                        <Route path='/home/admercial' element={<Admercial></Admercial>}></Route>
                    </Route>
                </Routes>
            </Suspense>
        </HashRouter>
    )
}

export default Router